package lifi

import (
	"context"
)

// Codec is a codec for marshaling and unmarshaling data to and from bytes.
type Codec interface {
	// MarshalData marshals an data and the supported parts of context into bytes.
	MarshalData(context.Context, Data) ([]byte, error)
	// UnmarshalData unmarshals an data and supported parts of context from bytes.
	UnmarshalData(context.Context, []byte) (Data, context.Context, error)
}

type Serializer interface {
	Serialize(data Data) ([]byte, error)

	SerializeBatch(datas []Data) ([]byte, error)
}
